package com.mlnx.netty.app.ecg.session.core;

import com.mlnx.common.utils.MyLog;
import com.mlnx.mptp.model.ecg.ECGData;
import com.mlnx.mptp.model.ecg.ECGDeviceInfo;

import lombok.Data;

/**
 * Created by amanda.shan on 2019/10/10.
 */
@Data
public class EcgDeviceSession extends DeviceSession {

    private MyLog log = MyLog.getLog(getClass());

    private boolean fristEcgPacket = true;

    private int filterTimes;

    public EcgDeviceSession(String deviceId, byte[] gpu8AcId) {
        super(deviceId);

//        analysis = new EcgAnalysisServiceIml(deviceId, gpu8AcId);
//        analysis.init();
    }

    public int getFilterTimes() {
        return filterTimes;
    }

    public void subFilterTimes() {
        filterTimes--;
    }


    public boolean isFristEcgPacket() {
        return fristEcgPacket;
    }

    public void setFristEcgPacket(boolean fristEcgPacket) {
        this.fristEcgPacket = fristEcgPacket;
    }

    public void setECGDeviceInfo(ECGDeviceInfo info){
        if (info.getPei() != null){
//            log.info(deviceId +" 导联改变");
        }
//        PatientMonitoringDataCache.CACHE.getSession(patientId).setECGDeviceInfo(info);
    }

    public void setECGData(ECGData ecgData){
//        PatientMonitoringDataCache.CACHE.getSession(patientId).setECGData(ecgData);
    }

    @Override
    public String toString() {
        return "EcgDeviceSession{" +
                "fristEcgPacket=" + fristEcgPacket +
                ", filterTimes=" + filterTimes +
                ", deviceId='" + deviceId + '\'' +
                ", patientId=" + patientId +
                ", deviceType=" + deviceType +
                ", channel=" + channel +
                ", topicFilters=" + topicFilters +
                ", lastPacketTime=" + lastPacketTime +
                '}';
    }
}
